package com.hnkywl.sts.service.organ;

import com.google.gson.Gson;
import com.hnkywl.sts.dao.base.SjzdzDao;
import com.hnkywl.sts.dao.organ.*;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.htgl.Bgfkfs;
import com.hnkywl.sts.entity.htgl.Fkfs;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.service.base.BmService;
import com.hnkywl.sts.util.BaseUtils;
import com.hnkywl.sts.util.ReflectionUtils;
import jxl.Cell;
import net.ruixin.orm.hibernate.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.*;

/**
 * 说明：
 * 包:        com.hnkywl.sts.service.sys
 * 类描述:    角色服务类
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Service
public class QyjgService {
    private QyjgDao qyjgDao;
    private SjzdzDao sjzdzDao;
    private GsjgDao gsjgDao;
    private WlsDao wlsDao;
    private BmService bmService;
    private LjwhDao ljwhDao;
    private FkfsDao fkfsDao;

    /**
     * 查询企业机构列表
     *
     * @param qc       企业机构名称
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Transactional
    public String findAllQyjg(String qc, String jc, String lxr, int pageNo, int pageSize) {
        Page<Qyjg> qyjgPage = this.qyjgDao.findQyjgList(qc, jc, lxr, pageNo, pageSize);
        List<Qyjg> qyjgList = qyjgPage.getResult() == null ? new ArrayList<Qyjg>() : qyjgPage.getResult();
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc", "bm", "zjm", "bz", "sfzx", "sfls", "qyfr.qyqc", "qyfr.id", "lxdh", "lxr", "jyms.id", "jyms.bz", "zt", "bzjfs", "processInstanceId");
        return "{\"total\":" + qyjgPage.getTotalCount() + ",\"rows\":[" + qyjgJson + "]}";
    }


    @Transactional
    public String findAllQyjg1(String qc, String jc, String lxr, int pageNo, int pageSize) {
        Page<Qyjg> qyjgPage = this.qyjgDao.findQyjgList1(qc, jc, lxr, pageNo, pageSize);
        List<Qyjg> qyjgList = qyjgPage.getResult() == null ? new ArrayList<Qyjg>() : qyjgPage.getResult();
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc", "bm", "zjm", "bz", "sfzx", "sfls", "qyfr.qyqc", "qyfr.id", "lxdh", "lxr", "jyms.id", "jyms.bz", "zt", "bzjfs", "processInstanceId");
        return "{\"total\":" + qyjgPage.getTotalCount() + ",\"rows\":[" + qyjgJson + "]}";
    }


    /**
     * 查询计划单位
     *
     * @param qc
     * @param jc
     * @param lxr
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Transactional
    public String findAllJhdw(String qc, String jc, String lxr, int pageNo, int pageSize) {
        Page<Gsjg> jhdwPage = this.gsjgDao.findJhdwList(qc, jc, lxr, pageNo, pageSize);
        List<Gsjg> jhdwList = jhdwPage.getResult() == null ? new ArrayList<Gsjg>() : jhdwPage.getResult();
        String jhdwJson = BaseUtils.fetchCollectionToJson(jhdwList, "id", "qc", "jc", "bm", "qyfr.qyqc");
        return "{\"total\":" + jhdwPage.getTotalCount() + ",\"rows\":[" + jhdwJson + "]}";
    }

    @Transactional
    public String findAllLskh(String qc, String jc, int pageNo, int pageSize) {
        Page<Qyjg> lskhPage = this.qyjgDao.findLskhList(qc, jc, pageNo, pageSize);
        List<Qyjg> lskhList = lskhPage.getResult() == null ? new ArrayList<Qyjg>() : lskhPage.getResult();
        String lskhJson = BaseUtils.fetchCollectionToJson(lskhList, "id", "qc", "jc", "bm", "zjm", "bz", "sfzx", "qyfrh", "zzjgh", "nsh");
        return "{\"total\":" + lskhPage.getTotalCount() + ",\"rows\":[" + lskhJson + "]}";
    }

    /**
     * 通过内部公司Id返回所有上游 供应商
     *
     * @return
     */
    @Transactional
    public String findAllGysByNbgsId(Long gsjgId) {
        List<Map> qyjgList = this.qyjgDao.findAllGysByNbgsId(gsjgId);
        List<Qyjg> qyjgs = new ArrayList<Qyjg>();
        for (Map m : qyjgList) {
            Qyjg q = new Qyjg();
            q.setId(Long.parseLong(m.get("qyjg.id").toString()));
            q.setJc(m.get("qyjg.jc").toString());
            qyjgs.add(q);
        }
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgs, "id", "jc");
        return "[" + qyjgJson + "]";

    }

    /**
     * 通过内部公司Id返回所有上游 供应商
     *
     * @return
     */
    @Transactional
    public String findAllGys() {
        List<Map> qyjgList = this.qyjgDao.findAllGys();
        List<Qyjg> qyjgs = new ArrayList<Qyjg>();
        for (Map m : qyjgList) {
            Qyjg q = new Qyjg();
            q.setId(Long.parseLong(m.get("qyjg.id").toString()));
            q.setJc(m.get("qyjg.jc").toString());
            qyjgs.add(q);
        }
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgs, "id", "jc");
        return "[" + qyjgJson + "]";

    }

    /**
     * 通过内部公司Id返回所有下游 客户
     *
     * @return
     */
    @Transactional
    public String findAllKhByNbgsId(Long nbgsId) {
        List<Map> qyjgList = this.qyjgDao.findAllKhByNbgsId(nbgsId);
        List<Qyjg> qyjgs = new ArrayList<Qyjg>();
        for (Map m : qyjgList) {
            Qyjg q = new Qyjg();
            q.setId(Long.parseLong(m.get("qyjg.id").toString()));
            q.setJc(m.get("qyjg.jc").toString());
            qyjgs.add(q);
        }
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgs, "id", "jc");
        return "[" + qyjgJson + "]";

    }

    @Transactional
    public String findAllKsyJkdByNbgsId(Long nbgsId) {
        List<Map> qyjgList = this.qyjgDao.findAllKsyJkdByNbgsId(nbgsId);
        List<Qyjg> qyjgs = new ArrayList<Qyjg>();
        for (Map m : qyjgList) {
            Qyjg q = new Qyjg();
            q.setId(Long.parseLong(m.get("qyjg.id").toString()));
            q.setJc(m.get("qyjg.jc").toString());
            qyjgs.add(q);
        }
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgs, "id", "jc");
        return "[" + qyjgJson + "]";

    }


    //含有物流商的企业机构查询
    @Transactional
    public String findQyjgJc(String jc, int pageNo, int pageSize) {
        Page<Qyjg> qyjgPage = this.qyjgDao.findQyjgJcList(jc, pageNo, pageSize);
        List<Qyjg> qyjgList = qyjgPage.getResult() == null ? new ArrayList<Qyjg>() : qyjgPage.getResult();
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "jc");
        return "[" + qyjgJson + "]";
    }

    //不含物流商的企业机构查询
    @Transactional
    public String findQyjgJcNotWls(String jc, int pageNo, int pageSize) {
        List<Map> allPage = this.qyjgDao.findQyjgJcListNotWls(jc, pageNo, pageSize);
        Gson gson = new Gson();
        String result = gson.toJson(allPage);
        return result;
    }

    //不含物流商的企业机构查询
    @Transactional
    public String findQyjgQcNotWls(String jc, int pageNo, int pageSize) {
        List<Map> allPage = this.qyjgDao.findQyjgQcListNotWls(jc, pageNo, pageSize);
        Gson gson = new Gson();
        String result = gson.toJson(allPage);
        return result;
    }


    @Transactional
    public List<Qyjg> findAallQyjg() {
        return this.qyjgDao.findAallQyjg();
    }

    @Transactional
    public String lskhCheckProperty(String propertyName, String propertyValue) {
        List<Qyjg> qyjgList = qyjgDao.findLskhByPropertyName(propertyName, propertyValue);
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "jc", "qc", "bm", "zjm", "sfzx", "sfls", "lskh", "qyfrh", "zzjgh", "nsh");
        return "[" + qyjgJson + "]";
    }

    @Transactional
    public List<Khh> findKhhByQyjg() {
        List<Qyjg> qyjgList = this.qyjgDao.findAallQyjg();
        List<Khh> khhList = new ArrayList<Khh>();
        if (qyjgList != null && qyjgList.size() > 0) {
            for (Qyjg q : qyjgList) {
                if (q.getKhhList() != null && q.getKhhList().size() > 0) {
                    for (Khh h : q.getKhhList()) {
                        khhList.add(h);
                    }
                }
            }
        }
        return khhList;
    }


    /**
     * 获取企业机构组织树
     *
     * @param
     * @return
     */
    public String findAllQyjgTree() {
        List<Qyjg> qyjgList = new ArrayList<Qyjg>();
        qyjgList.addAll(qyjgDao.findAllRootLxr());
        Map<String, String> treeParam = new HashMap<String, String>();
        treeParam.put("text", "qc");
        treeParam.put("id", "id");
        return BaseUtils.getTreeJson(qyjgList, treeParam);
    }

    public String findAllQyjgJcTree() {
        List<Qyjg> qyjgList = new ArrayList<Qyjg>();
        qyjgList.addAll(qyjgDao.findAllRootLxr());
        Map<String, String> treeParam = new HashMap<String, String>();
        treeParam.put("text", "jc");
        treeParam.put("id", "id");
        return BaseUtils.getTreeJson(qyjgList, treeParam);
    }

    public String findAllLskhJcTree() {
        List<Qyjg> qyjgList = new ArrayList<Qyjg>();
        qyjgList.addAll(qyjgDao.findAllRootLskh());
        Map<String, String> treeParam = new HashMap<String, String>();
        treeParam.put("text", "jc");
        treeParam.put("id", "id");
        return BaseUtils.getTreeJson(qyjgList, treeParam);
    }

    public String findAllLskhTree() {
        List<Qyjg> qyjgList = new ArrayList<Qyjg>();
        qyjgList.addAll(qyjgDao.findAllRootLskh());
        Map<String, String> treeParam = new HashMap<String, String>();
        treeParam.put("text", "qc");
        treeParam.put("id", "id");
        return BaseUtils.getTreeJson(qyjgList, treeParam);
    }

    /**
     * 查询企业机构名称列表
     *
     * @param
     */
    @Transactional
    public String findQyjgMc() {
        Set<Qyjg> qyjgList = qyjgDao.findAllRootQyjg() == null ? new HashSet<Qyjg>() : qyjgDao.findAllRootQyjg();
        String qyfrJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc");
        return "[" + qyfrJson + "]";
    }

    //零售类型 企业机构
    @Transactional
    public String findLxQyjg() {
        List<Qyjg> qyjgList = qyjgDao.findAllLxQyjg() == null ? new ArrayList<Qyjg>() : qyjgDao.findAllLxQyjg();
        String lsJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc");
        return "[" + lsJson + "]";
    }


    @Transactional
    public String findQyjgBm(Long qyjgId) {
        String json = "";
        if (qyjgId != null) {
            Gsjg qyjg = gsjgDao.get(qyjgId);
            List<Gsjg> qyjgList = qyjg.getGsjgList();
            if (!CollectionUtils.isEmpty(qyjgList))
                json = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc");
        }
        return "[" + json + "]";
    }

    @Transactional
    public String findJhdwBm(Long ljId) {
        String json = "";
        if (ljId != null) {
            Lj lj = ljwhDao.get(ljId);
            List<Gsjg> qyjgList = lj.getXy();
            if (!CollectionUtils.isEmpty(qyjgList))
                json = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc");
        }
        return "[" + json + "]";
    }

    @Transactional
    public String findHzfBm(Long ljId) {
        String json = "";
        if (ljId != null) {
            Lj lj = ljwhDao.get(ljId);
            List<Gsjg> qyjgList = lj.getSy();
            if (!CollectionUtils.isEmpty(qyjgList))
                json = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc");
        }
        return "[" + json + "]";
    }

    /**
     * 查询所有的联系人
     *
     * @return
     */
    @Transactional
    public String findQyjgLxr() {
        List<Qyjg> qyjgList = qyjgDao.findAllRootLxr() == null ? new ArrayList<Qyjg>() : qyjgDao.findAllRootLxr();
        String qyfrJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "lxr");
        return "[" + qyfrJson + "]";
    }

    /**
     * 查询企业机构明细
     *
     * @param id 企业机构id
     * @return
     */
    @Transactional
    public Qyjg findQyjgDetail(Long id) {
        return this.qyjgDao.get(id);
    }


    /**
     * 查询企业机构明细
     *
     * @param processInstanceId 流程实体ID
     * @return
     */
    @Transactional
    public Qyjg finQyjgDetailByProcessInstance(String processInstanceId) {
        return this.qyjgDao.findUniqueByProperty("processInstanceId", processInstanceId);
    }

    public String getJgbm() {
        return bmService.getJgbm();
    }

    /**
     * 保存企业机构信息
     *
     * @param qyjg 企业机构实体
     * @return
     */
    @Transactional
    public void saveQyjg(Qyjg qyjg) throws RuntimeException {
        nullId(qyjg);
        if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getQc(), "qc")) {
            throw new RuntimeException("此全称已存在");
        }
        if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getJc(), "jc")) {
            throw new RuntimeException("简称已存在");
        }
        if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getBm(), "bm")) {
            throw new RuntimeException("编码重复");
        }
        if (qyjg.getGsjgList() != null) {
            for (Gsjg nbjg : qyjg.getGsjgList()) {
                nbjg.setSjjg(qyjg);
                nbjg.setSfzx(null);
            }
        }
        if (StringUtils.isEmpty(qyjg.getBm())) {
            String bm = this.getJgbm();
            qyjg.setBm(bm);
        }
        if (StringUtils.isEmpty(qyjg.getZt())) {
            qyjg.setZt("ybc");
            qyjg.setSfzx(!qyjg.getSfzx());
        }
        qyjg.setDateCreated(new Date());
        qyjg.setLastUpdated(new Date());
        this.qyjgDao.save(qyjg);
    }

    @Transactional
    public void saveLskh(Qyjg qyjg) throws RuntimeException {
        if (qyjg.getId() == null) {
            nullId(qyjg);
            if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getQc(), "qc")) {
                throw new RuntimeException("此全称已存在");
            }
            if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getJc(), "jc")) {
                throw new RuntimeException("简称已存在");
            }
            if (qyjgDao.checkUnique(qyjg.getId(), qyjg.getBm(), "bm")) {
                throw new RuntimeException("编码重复");
            }
            String bm = this.getJgbm();
            qyjg.setBm(bm);
            qyjg.setSfzx(!qyjg.getSfzx());
            qyjg.setDateCreated(new Date());
            qyjg.setLastUpdated(new Date());
            this.qyjgDao.save(qyjg);
        }
    }

    /**
     * 删除企业机构信息
     *
     * @param qyjgId 企业机构id
     * @return
     */
    @Transactional
    public void deleteQyjg(Long qyjgId) {
        Qyjg qyjg = qyjgDao.get(qyjgId);
        if (!qyjg.getSyljList().isEmpty() || !qyjg.getXyljList().isEmpty()) {
            throw new RuntimeException("禁止删除！该机构已在路径维护中使用");
        }
        if (!qyjg.getKhhList().isEmpty()) {
            throw new RuntimeException("禁止删除！该机构已在企业开户行中使用");
        }
        if (!qyjg.getSfzx()) {
            throw new RuntimeException("禁止删除！机构已启用");
        }
        qyjg.setLastUpdated(new Date());
        qyjg.setDeleted(1);
        this.qyjgDao.save(qyjg);
    }

    /**
     * 删除内部机构
     *
     * @param id
     */
    @Transactional
    public void deleteNbjg(Long id) {
        Gsjg gsjg = gsjgDao.get(id);
        gsjg.setLastUpdated(new Date());
        gsjg.setDeleted(1);
        this.gsjgDao.save(gsjg);
    }


    @Transactional
    public void commitqyjg(Qyjg qyjg) {
        qyjg.setZt("ysp");
        this.qyjgDao.save(qyjg);
    }


    /**
     * 更新企业机构信息
     *
     * @param qyjg 企业机构实体
     * @return
     */
    @Transactional
    public void updateQyjg(Qyjg qyjg) throws RuntimeException {
        //传入的qyjg的getGsjgList的包含有ID和没有ID的；有ID的要进行修改，没有ID的要保存入数据库
        Qyjg temp = this.qyjgDao.get(qyjg.getId());
        qyjg.setZt("ybc");
        qyjg.setSfzx(!qyjg.getSfzx());
        temp = (Qyjg) ReflectionUtils.getInstance(temp, qyjg);
        nullId(temp);
        temp.setSfzx(false);
        if (qyjg.getGsjgList() != null) {
            for (Gsjg nbjg : qyjg.getGsjgList()) {
                nbjg.setSjjg(qyjg);
                nbjg.setSfzx(false);
            }
        }
        temp.setLastUpdated(new Date());
        this.qyjgDao.save(temp);
    }

    /**
     * 修改零售客户
     *
     * @param qyjg
     * @throws RuntimeException
     */
    @Transactional
    public void updateLskh(Qyjg qyjg) throws RuntimeException {
        //传入的qyjg的getGsjgList的包含有ID和没有ID的；有ID的要进行修改，没有ID的要保存入数据库
        Qyjg temp = this.qyjgDao.get(qyjg.getId());
        qyjg.setSfzx(false);
        qyjg.setLskh(!qyjg.getLskh());
        temp = (Qyjg) ReflectionUtils.getInstance(temp, qyjg);
        nullId(temp);
        temp.setLastUpdated(new Date());
        this.qyjgDao.save(temp);
    }

    /**
     * 关联判断
     *
     * @param qyjg
     */
    private void nullId(Qyjg qyjg) {
        if (qyjg != null && qyjg.getYjg() != null && qyjg.getYjg().getId() == null)
            qyjg.setYjg(null);
        if (qyjg != null && qyjg.getSjjg() != null && qyjg.getSjjg().getId() == null)
            qyjg.setSjjg(null);
        if (qyjg != null && qyjg.getQyfr() != null && qyjg.getQyfr().getId() == null)
            qyjg.setQyfr(null);

    }

    /**
     * 启动企业机构
     *
     * @param id
     */
    @Transactional
    public void startQyjg(Long id) {
        Qyjg qyjg = qyjgDao.get(id);
        qyjg.setLastUpdated(new Date());
        qyjg.setSfzx(false);
        this.qyjgDao.save(qyjg);
    }

    /**
     * 停用企业机构
     *
     * @param id
     */
    @Transactional
    public void stopQyjg(Long id) {
        Qyjg qyjg = qyjgDao.get(id);
        if (!qyjg.getSyljList().isEmpty() || !qyjg.getXyljList().isEmpty()) {
            throw new RuntimeException("禁止停用！该机构已在路径维护中使用");
        }
        qyjg.setLastUpdated(new Date());
        qyjg.setSfzx(true);
        this.qyjgDao.save(qyjg);
    }


    /**
     * 设置企业机构为内部公司
     *
     * @param id
     */
    @Transactional
    public void qyjgNbgs(Long id) {
        Qyjg qyjg = qyjgDao.get(id);
        if (!qyjg.getSyljList().isEmpty() || !qyjg.getXyljList().isEmpty()) {
            throw new RuntimeException("禁止设置！该机构已在路径维护中使用");
        }
        qyjgDao.executeSQL("update T_SYS_GSJG set type='nbgs',sjjg_id=1,pxh=1 where id=?", id);
    }


    /**
     * ajax远程验证
     *
     * @param value 验证值
     * @param field 验证字段
     * @param type
     * @return
     */
    public boolean ajaxValidate(Long id, String value, String field, Integer type) {
        if (type == 0) {
            return qyjgDao.checkUnique(id, value, field);
        } else {
            return wlsDao.checkUnique(id, value, field);
        }
    }

    /**
     * 获取所有的企业机构
     *
     * @param qyjgId
     * @return
     */
    @Transactional
    public String findNbjg(Long qyjgId) {
        List<Gsjg> qyjgList = gsjgDao.findNbjgById(qyjgId) == null ? new ArrayList<Gsjg>() : gsjgDao.findNbjgById(qyjgId);
        String qyjgJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc", "bz", "bm", "zjm");
        return "[" + qyjgJson + "]";
    }

    public String findAllSy(String key, Integer size) {
        List<Qyjg> list = qyjgDao.findAllSy(key, size);
        String json = BaseUtils.fetchCollectionToJson(list, "id", "qc");
        return "[" + json + "]";
    }

    public Qyjg findByJc(String jc) {
        return this.qyjgDao.findUniqueByProperty("jc", jc);
    }

    public String findAllXy(String key, Integer size) {
        List<Qyjg> list = qyjgDao.findAllXy(key, size);
        String json = BaseUtils.fetchCollectionToJson(list, "id", "qc");
        return "[" + json + "]";
    }

    public String findByZjmOrJcOrQc(String zjm, String jc, String qc, Long id, Integer maxRows) {
        return new Gson().toJson(qyjgDao.findByZjmOrJcOrQc(zjm, jc, qc, id, maxRows));
    }

    public String findLskhByZjmOrJcOrQc(String zjm, String jc, String qc, Long id, Integer maxRows) {
        return new Gson().toJson(qyjgDao.findLskhByZjmOrJcOrQc(zjm, jc, qc, id, maxRows));
    }

    public String findAllLjQyjg() {
        List qyjgList = qyjgDao.findAllLjQyjg();
        String qyfrJson = BaseUtils.fetchCollectionToJson(qyjgList, "id", "qc", "jc", "qyfr.nsh");
        return "[" + qyfrJson + "]";
    }

    public Qyjg findQyjgByQc(String qcName) {
        return this.qyjgDao.findQyjgByQc(qcName);
    }

    public Zyf findZyfByQc(String qcName) {
        return this.qyjgDao.findZyfByQc(qcName);
    }


    @Transactional
    public String findFkfsByQyjgId(Long qyjgId) {
        List<Map> allPage = this.fkfsDao.findFkfsByQyjgId(qyjgId);
        Gson gson = new Gson();
        String result = gson.toJson(allPage);
        return result;
    }

    @Transactional
    public void qyjgFkfs(Qyjg qyjg) throws RuntimeException {
        Qyjg item = qyjgDao.get(qyjg.getId());
        item.setFkfsList(qyjg.getFkfsList());
        item.setBzjbl(qyjg.getBzjbl());
        qyjgDao.save(item);
    }

    @Transactional
    public void saveFkfs(Qyjg qyjg) {
        Fkfs fkfsXh = new Fkfs();
        Sjzdz sjzdzXh = this.sjzdzDao.get(8L);
        fkfsXh.setFklx(sjzdzXh);
        fkfsXh.setFksjStart(0);
        fkfsXh.setFksj(10);
        fkfsXh.setQyjg(qyjg);
        fkfsXh.setFkgs("1");
        this.fkfsDao.save(fkfsXh);
        Fkfs fkfsCd = new Fkfs();
        Sjzdz sjzdzCd = this.sjzdzDao.get(9L);
        fkfsCd.setFklx(sjzdzCd);
        fkfsCd.setFksjStart(0);
        fkfsCd.setFksj(10);
        fkfsCd.setQyjg(qyjg);
        fkfsCd.setFkgs("1");
        this.fkfsDao.save(fkfsCd);
    }

    @Autowired
    public void setQyjgDao(QyjgDao qyjgDao) {
        this.qyjgDao = qyjgDao;
    }

    @Autowired
    public void setSjzdzDao(SjzdzDao sjzdzDao) {
        this.sjzdzDao = sjzdzDao;
    }

    @Autowired
    public void setGsjgDao(GsjgDao gsjgDao) {
        this.gsjgDao = gsjgDao;
    }

    @Autowired
    public void setWlsDao(WlsDao wlsDao) {
        this.wlsDao = wlsDao;
    }

    @Autowired
    public void setBmService(BmService bmService) {
        this.bmService = bmService;
    }

    @Autowired
    public void setLjwhDao(LjwhDao ljwhDao) {
        this.ljwhDao = ljwhDao;
    }

    @Autowired
    public void setFkfsDao(FkfsDao fkfsDao) {
        this.fkfsDao = fkfsDao;
    }


}
